package com.bit.lotterySystem.dao.mapper;

import com.bit.lotterySystem.dao.dataobject.Encrypt;
import com.bit.lotterySystem.dao.dataobject.UserDo;
import org.apache.ibatis.annotations.*;

@Mapper
public interface UserMapper {
    @Select("select count(*) from user where email = #{email}")
    int countMail(String email);

    @Select("select count(*) from user where phone_number = #{phoneNumber}")
    int countPhoneNumber(@Param("phoneNumber") Encrypt phoneNumber);

    @Insert("insert into user (user_name, email, identity, password, phone_number)" +
    " values(#{userName}, #{email}, #{identity}, #{password}, #{phoneNumber})")
    @Options(useGeneratedKeys = true, keyColumn = "id", keyProperty = "id")
    void insert(UserDo userDo);
}
